import VueI18n from 'vue-i18n'
import Vue from 'vue'
import store from "../store"
//引入自定义语言包
import zh from "./lang/zh"
import en from "./lang/en"
//element ui 国际化
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import ElementLocale from 'element-ui/lib/locale'

const messages = {
    en: {
        msg: {
            ...en
        },
        ...enLocale
    },
    zh: {
        msg: {
            ...zh
        },
        ...zhLocale
    }
}
const locale = store.getters.language
Vue.use(VueI18n)
let i18n = new VueI18n({
    messages,
    locale
})
ElementLocale.i18n((key, value) => i18n.t(key, value))
export default i18n